package cn.edu.seu.ssny.service.impl;

import cn.edu.seu.ssny.dao.IMachineGroupDao;
import cn.edu.seu.ssny.dao.support.IBaseDao;
import cn.edu.seu.ssny.entity.MachineGroup;
import cn.edu.seu.ssny.entity.Project;
import cn.edu.seu.ssny.service.IMachineGroupService;
import cn.edu.seu.ssny.service.support.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MachineGroupServiceImpl extends BaseServiceImpl<MachineGroup, Integer> implements IMachineGroupService {
    @Autowired
    private IMachineGroupDao machineGroupDao;

    @Override
    public IBaseDao<MachineGroup, Integer> getBaseDao() {
        return machineGroupDao;
    }

    @Override
    public MachineGroup findByProjectAndName(Project project, String name) {
        return machineGroupDao.findMachineGroupByProjectAndAndName(project, name);
    }

    @Override
    public List<MachineGroup> findByProject(Project project) {
        return machineGroupDao.findMachineGroupsByProjectOrderByName(project);
    }
}
